const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  let welcome = "";
  if (hour >= 0 && hour <= 12) {
    welcome = "上午好";
    // console.log(welcome);
  } else if (hour > 12 && hour <= 18) {
    welcome = "下午好";
  } else {
    welcome = "晚上好";
  }
  return welcome
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

const weekId = (date) =>{
  var today = new Date();
  var currentDate = today.getDay(); //获取存储当前日期
  var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  return  weekday[currentDate];
}


module.exports = {
  formatTime,
  weekId,
}